import Vue from 'vue'

const slider = Vue.directive('slider', {
    inserted(el, binding) {
        const defaultOptions = {
            mainCell: '.bd ul',
            autoPage: true,
            effect: 'leftLoop',
            autoPlay: false,
            scroll: 2,
            vis: 4,
        }
        const customOptions = typeof binding.value === 'object' ? binding.value : {}
        const realOptions = Object.assign({}, defaultOptions, customOptions)
        jQuery(el).slide(realOptions)
    }
})

export default slider
